home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / Expander / Sample Source / x_CMain.cp < prev    next >
Encoding:
Text File  |  1994-11-30  |  3.5 KB  |  134 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  x_CMain.cp
  3.  
  4.                 CMain Document Class
  5.     
  6.     Copyright Â© 1994 My Software Inc. All rights reserved.
  7.  
  8.     Generated by Visual Architectâ„¢ 9:40 PM Wed, Jun 8, 1994
  9.  
  10.     This file is rewritten each time you generate code. You should not
  11.     make changes to this file; changes should go in the My.cp
  12.     file, instead.
  13.  
  14.     If you want to change how Visual Architect generates this file, you can
  15.     change the template for this file. It is "_Doc_cp" in the Visual Architect
  16.     Templates folder.
  17.  
  18.  ******************************************************************************/
  19.  
  20. #include "x_CMain.h"
  21.  
  22. #include "CMain.h"
  23.  
  24. #include "MainItems.h"
  25.  
  26. #include "ViewUtilities.h"
  27. #include "CApp.h"
  28.  
  29. #include <CApplication.h>
  30. #include <CBartender.h>
  31. #include <Commands.h>
  32. #include <Constants.h>
  33. #include <CDecorator.h>
  34. #include <CDesktop.h>
  35. #include <CFile.h>
  36. #include <TBUtilities.h>
  37. #include <CWindow.h>
  38.  
  39. extern    CApplication *gApplication;        /* The application                    */
  40. extern CDecorator    *gDecorator;        /* Decorator for arranging windows    */
  41. extern CDesktop        *gDesktop;            /* The visible Desktop                */
  42. extern CBartender    *gBartender;        /* Manages all menus                */
  43.  
  44. #include "CSubviewDisplayer.h"
  45.  
  46.     // Define symbols for commands handled by this class
  47.     // Prevents a recompile every time any command changed.
  48.  
  49.  
  50.  
  51. TCL_DEFINE_CLASS_M1(x_CMain, x_CMain_super);
  52.  
  53. /**** C O N S T R U C T I O N / D E S T R U C T I O N   M E T H O D S ****/
  54.  
  55.  
  56. /******************************************************************************
  57.  Ix_CMain
  58.  
  59.     Initialize the document
  60.  ******************************************************************************/
  61.  
  62. void x_CMain::Ix_CMain()
  63.  
  64. {
  65.     IDocument(gApplication, TRUE);
  66.  
  67.         // Initialize data members below.
  68. }
  69.  
  70.  
  71. /******************************************************************************
  72.  MakeNewWindow
  73.  
  74.     Create a new, empty window.  Subclass may override to populate
  75.     the new window.
  76.  ******************************************************************************/
  77.  
  78. void x_CMain::MakeNewWindow(void)
  79.  
  80. {
  81.     itsWindow = TCLGetNamedWindow("\pMain", this);
  82.     
  83.     itsMainPane = (CPane*) TCLGetItemPointer(itsWindow, 0);
  84.  
  85.         // Initialize pointers to the subpanes in the window
  86.  
  87.   fMain_Subv3 = (CSubviewDisplayer*) itsWindow->FindViewByID(kMain_Subv3ID);
  88.   ASSERT(member(fMain_Subv3, CSubviewDisplayer));
  89.  
  90. }
  91.  
  92.  
  93. /******************************************************************************
  94.  FailOpen {OVERRIDE}
  95.  
  96.         Fail if file already open in this application.
  97.         
  98.         This function calls the application's FileAlreadyOpen function
  99.         and fails quietly if the file is open.
  100.  
  101.         Note that open may also fail if the file is open in
  102.         another application. This will cause a failure in open,
  103.         but you may wish to override this function to detect this
  104.         case and provide a more meaningful error message than -49.
  105.  ******************************************************************************/
  106.  
  107. void    x_CMain::FailOpen(
  108.     CFile    *aFile)
  109.  
  110. {
  111.                                         /* Only the application knows        */
  112.     if (((CApp*)gApplication)->FileAlreadyOpen(aFile))
  113.         Failure(kSilentErr, 0);
  114. }
  115.  
  116.  
  117. /******************************************************************************
  118.  PositionWindow
  119.  
  120.     The default method in CSaver calls the the decorator, which
  121.     staggers and resizes the window. Since the window has already
  122.     been positioned when it is initialized from the view resource,
  123.     we don't want to do this twice.
  124.  ******************************************************************************/
  125.  
  126. void    x_CMain::PositionWindow()
  127.  
  128. {
  129. }
  130.  
  131.  
  132.  
  133.  
  134.